package com.by.wx.factory;

import com.by.wx.process.msg.MessageProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @Author 陈子杰
 * @Description
 * @Version 1.0.0
 * @Date 2025/1/2 2:54
 */
@Component
public class MessageProcessFactory {
    private final Map<String, MessageProcessor> processorMap;

    @Autowired
    public MessageProcessFactory(Map<String, MessageProcessor> processorMap) {
        this.processorMap = processorMap;
    }

    public MessageProcessor getHandler(String keyword) {
        if (keyword.startsWith("亚万登记")) {
            return processorMap.get("cXProcessFactory");
        } else {
            return null;
        }
    }
}
